<style>
.row-main,.notification-main{
	height:1300px;
}
</style>
<div class="notification-main">
	<div class="History-box">
	  <h1 class="title">Active Auto-bid</h1>

<?php
 $this->widget('zii.widgets.grid.CGridView', 
  array(
  'id'=>'autobid-grid',
  'dataProvider'=>$autobid->search_myaccount(),
  // 'filter'=>$model,
  'template'=>"{items}\n{summary}\n{pager}",

  'columns'=>array(
      array(
				    'name'=>'title',
				    'header'=>'Auction Title',
				    'type'=>'raw',
				    'value'=>'Autobid::getDetailUrl($data)'
		),
	    array(
	      'name'=>'created',
	      'value' =>  function($data){ return date('Y-m-d H:i:s',$data->created);},
	      ),
       array(
          'name'=>'Start Price',
           'value'=>'"$".$data->start_price'
        ),
	    array(
	      'name'=>'Max Bids',
	      'value' => '$data->init_amount',
	      ),
	      array(
	          'name'=>'Remain Bids',
	          'value' => '$data->amount',
	      ),
	      array(
	          'name'=>'Delete',
	          'type'=>'raw',
	          'header'=>'Operation',
	          'value'=>function($data){ 
	                   return CHtml::button("Remove",array(
	                       'autobid-id'=>$data->id,
	                       'class'=>'delete-autobid'
	                   ));
	           }
         )
	),))?>
	</div>
</div>
<script>
	$("body").on("click",".delete-autobid",function(event){
		var autobidId=$(this).attr("autobid-id");
		console.log(autobidId);
		$.ajax({
			url:"<?php echo Yii::app()->baseUrl?>/myaccount/delete",
			dataType:"json",
			data:{"autobidId":autobidId},
			type:"get",
			success:function(data){
				console.log(data);
				$.fn.yiiGridView.update('autobid-grid');
			}
		});
		return false;
	})
 </script>